<?php
require_once('conn.inc.php');
@$conn	=	mysql_connect($db_host,$db_user,$db_pwd);
mysql_query("set names 'utf8'");
mysql_select_db($db_name);

@$hid = $_POST['hid'];			//房间id
@$id = $_POST['id'];			//登陆者id
@$fid = $_POST['fid'];			//组局人id
@$posttime=time();

if ($id == $fid) {
	$rc = array('code'=>-1);								//活动发起人不能取消房间
	echo json_encode($rc);
}else{
	@$find = "select * from hometeam where fid='$id' && state=1"; //LIMIT 0,10
	$rf = mysql_query($find);
	$row = mysql_fetch_row($rf);
	$fhid = $row['hid'];
	if ($fhid == $hid) {
		$del = "delete from hometeam where fid = '$id' && hid = '$hid' && state=1";
		$result = mysql_query($del);
		if($result)
		{
			$rc = array('code'=>1);
			echo json_encode($rc);										//成功取消
		}
		else
		{
			$rc = array('code'=>-3);
			echo json_encode($rc);										//取消失败
		}
	}else{
		$rc = array('code'=>-2);
		echo json_encode($rc);										//非法操作，无组队或者一个以上
	}
}
mysql_close();



